/* Copyright 2010 John L. Reilly

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

     http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License. */

package com.riq.entity;

import java.io.Serializable;

import javax.jdo.annotations.IdGeneratorStrategy;
import javax.jdo.annotations.IdentityType;
import javax.jdo.annotations.PersistenceCapable;
import javax.jdo.annotations.Persistent;
import javax.jdo.annotations.PrimaryKey;

@PersistenceCapable(identityType = IdentityType.APPLICATION)
public class Tracking implements HasPrimaryKey<String>, Serializable {

	private static final long serialVersionUID = 1L;
	
	public String getPrimaryKey() {
		// TODO Auto-generated method stub
		return null;
	}

	@PrimaryKey
	@Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
	private Long id;

	@Persistent
	private Long deptId;

	@Persistent
	private Long alertId;

	@Persistent
	private Long locationId;
	
	@Persistent
	private Long timeStamp;
	
	@Persistent
	private Long authorId;
	  
	@Persistent
	private String type;
	  
	@Persistent
	private Long typeId; 
	  
	@Persistent
	private Long statusId;
	
	@Persistent
	private String responseType;

	
	public Tracking(Long deptId, Long alertId, Long locationId, 
	        		Long timeStamp, Long authorId, String type, 
	        		Long typeId, Long statusId, String responseType) {
	 this.deptId = deptId;
	 this.alertId = alertId;
	 this.locationId = locationId;	
	 this.timeStamp = timeStamp;
	 this.authorId = authorId;
	 this.type = type;
   this.typeId = typeId;
   this.statusId = statusId;
   this.responseType = responseType;

	}
	
	public boolean isAssignedALocation() {
	  return this.getlocationId() != null;
	}
	
  public boolean ownedByDept(final Department d) {
    return this.getdeptId().equals(d.getid());
  }
  
  public boolean hasThisStatus(final Status s) {
    return this.gettypeId().equals(s.getid());
  }

  public boolean isAtThisLocationId(final long getThisId) {
    // TODO Auto-generated method stub
    return this.gettypeId().equals(getThisId);
  }
  

  
  
	
// GETS

	public Long getid() {
		return id;
	}

	public Long getdeptId() {
		return deptId;
	}

	public Long getalertId() {
		return alertId;
	}
	
	public Long getlocationId() {
		return locationId;
	}

	public Long gettimeStamp() {
		return timeStamp;
	}

	public Long getauthorId() {
	  return authorId;
	}
	
	public String gettype() {
	  return type;
	}

	public Long gettypeId() {
	  return typeId;
    }
  
    public Long getstatusId() {
      return statusId;
    }
    
    public String getresponseType() {
      return responseType;
    }


// SETS
	
	public void setdeptId(Long deptId) {
		this.deptId = deptId;
	}

	public void setalertId(Long alertId) {
		this.alertId = alertId;
	}

	public void setlocationId(Long locationId) {
		this.locationId = locationId;
	}

	public void settimeStamp(Long timeStamp) {
		this.timeStamp = timeStamp;
	}
	
	public void setauthorId(Long authorId) {
	  this.authorId = authorId;
	}
	
	public void settype(String type) {
	  this.type = type;
	}

    public void settypeId(Long typeId) {
      this.typeId = typeId;
    }

    public void setstatus(Status status) {
      this.statusId = statusId;
    }
    
    public void setresponseType(String responseType) {
      this.responseType = responseType;
    }



}